package com.wang.ymcc.feignclient;

import com.wang.lwm.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;


@Component
public class CourseControllerFallBack implements FallbackFactory<CourseServerFegin> {

    @Override
    public CourseServerFegin create(Throwable throwable) {
        return new CourseServerFegin() {
            @Override
            public JSONResult courseStateById(Long id) {
                throwable.printStackTrace();
                return JSONResult.error("课程服务异常");
            }

            @Override
            public JSONResult info(String ids) {
                throwable.printStackTrace();
                return JSONResult.error("订单服务异常");
            }
        };
    }
}
